home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mmdf / mmdf-IIb.43 / src / phone / ph_wtmail.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-02-01  |  3.3 KB  |  127 lines

  1. #include "util.h"
  2. #include "mmdf.h"
  3. /*
  4.  *     MULTI-CHANNEL MEMO DISTRIBUTION FACILITY  (MMDF)
  5.  *     
  6.  *
  7.  *     Copyright (C) 1979,1980,1981  University of Delaware
  8.  *     
  9.  *     Department of Electrical Engineering
  10.  *     University of Delaware
  11.  *     Newark, Delaware  19711
  12.  *
  13.  *     Phone:  (302) 738-1163
  14.  *     
  15.  *     
  16.  *     This program module was developed as part of the University
  17.  *     of Delaware's Multi-Channel Memo Distribution Facility (MMDF).
  18.  *     
  19.  *     Acquisition, use, and distribution of this module and its listings
  20.  *     are subject restricted to the terms of a license agreement.
  21.  *     Documents describing systems using this module must cite its source.
  22.  *
  23.  *     The above statements must be retained with all copies of this
  24.  *     program and may not be removed without the consent of the
  25.  *     University of Delaware.
  26.  *     
  27.  *
  28.  *     version  -1    David H. Crocker    March   1979
  29.  *     version   0    David H. Crocker    April   1980
  30.  *     version  v7    David H. Crocker    May     1981
  31.  *     version   1    David H. Crocker    October 1981
  32.  *
  33.  */
  34.  
  35. extern struct ll_struct   *logptr;
  36.  
  37. /* **************  (ph_)  PHONE MAIL-WRITING SUB-MODULE  ************** */
  38.  
  39. LOCVAR short  ph_nadrs;             /* number of addresses this message   */
  40. LOCVAR  long ph_nchrs;            /* number of chars in msg text        */
  41.  
  42. /* ARGSUSED */
  43.  
  44. ph_winit (vianet, info, retadr)  /* pass msg initialization info       */
  45. char    vianet[];          /* what channel coming in from        */
  46. char    info[],              /* general info                       */
  47.         retadr[];          /* return address for error msgs      */
  48. {
  49.     short     retval;
  50.     char  initbuf[LINESIZE];
  51.  
  52. /* DBG:  make sure info has right form */
  53.  
  54. #ifdef DEBUG
  55.     ll_log (logptr, LLOGBTR, "ph_winit");
  56. #endif
  57.  
  58.     ph_nadrs = 0;
  59.     ph_nchrs = 0L;
  60.  
  61.     sprintf (initbuf, "%s;%s", info, retadr);
  62.                   /* slave:  <info> \n <retadr>    */
  63.     retval = ph_wrec (initbuf, strlen (initbuf));
  64.  
  65.     return (retval);
  66. }
  67. /* */
  68. /*ARGSUSED*/
  69. ph_wadr (host, adr)               /* send one address spec to local     */
  70. char    *host;              /* not used on phone channel */
  71. char    *adr;              /* "next" location part of address    */
  72. {
  73.     extern char *strdup ();
  74.     short     retval;
  75.     register char  *adrstr;
  76.  
  77. #ifdef DEBUG
  78.     ll_log (logptr, LLOGBTR, "ph_wadr()");
  79. #endif
  80.  
  81.     ph_nadrs++;
  82.  
  83.     adrstr = strdup (adr);
  84.                   /* tell the user, if watching         */
  85.     retval = ph_wrec (adrstr, strlen (adrstr));
  86.  
  87.     free (adrstr);
  88.     return (retval);
  89. }
  90.  
  91. ph_waend ()                      /* end of address lsit                */
  92. {
  93.     short     retval;
  94.  
  95. #ifdef DEBUG
  96.     ll_log (logptr, LLOGBTR, "ph_waend");
  97. #endif
  98.  
  99.     if (rp_isbad (retval = ph_wrec ((char *) 0, 0)))
  100.     return (retval);
  101.     return (RP_DONE);
  102. }
  103. /* */
  104.  
  105. ph_wtxt (buffer, len)            /* send next part of msg text         */
  106. char    buffer[];          /* the text                           */
  107. short     len;                      /* length of text                     */
  108. {
  109. #ifdef DEBUG
  110.     ll_log (logptr, LLOGBTR, "ph_wtxt()");
  111. #endif
  112.  
  113.     ph_nchrs += (long) len;
  114.  
  115.     return (ph_wstm (buffer, len));
  116. }
  117.  
  118. ph_wtend ()                      /* end of message text                */
  119. {
  120. #ifdef DEBUG
  121.     ll_log (logptr, LLOGBTR, "ph_wtend");
  122. #endif
  123.  
  124.     return (ph_wstm ((char *) 0, 0));
  125.                 /* flush text buffer / send eos       */
  126. }
  127.